﻿<Window x:Class="BuildRunner.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:app="clr-namespace:BuildRunner"
		Title="BuildRunner" Height="732" Width="880" Loaded="Window_Loaded" Icon="/BuildRunner;component/bukdRunner.ico">
	<Window.Resources>
		<Style x:Key="nodata" TargetType="Label">
			<EventSetter Event="PreviewDragOver" Handler="lbSetting_PreviewDragOver" />
			<EventSetter Event="Drop" Handler="lbSetting_Drop" />
		</Style>
	</Window.Resources>
	<Grid>
		<Grid.Resources>
			<Style TargetType="ListBoxItem">
				<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
			</Style>
		</Grid.Resources>
		<Grid.RowDefinitions>
			<RowDefinition Height="*"/>
			<RowDefinition Height="5"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>
		<DockPanel HorizontalAlignment="Stretch">
			<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
				<Button Name="btAdd" Content="+" Margin="5" Padding="20,3" Click="btAdd_Click">
					<Button.ContextMenu>
						<ContextMenu>
							<MenuItem Header="item1"/>
							<MenuItem Header="item2"/>
							<MenuItem Header="item3"/>
						</ContextMenu>
					</Button.ContextMenu>
				</Button>
				<Button Name="btRun" Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Run}" Margin="5" Padding="20,3" Click="btRun_Click" MaxWidth="{Binding}" />
				<Button Name="btSave" Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Save}" Margin="5" Padding="20,3" Click="btSave_Click" />
				<Button Name="btLoad" Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Load}" Margin="5" Padding="20,3" Click="btLoad_Click" />
				<Button Name="btJP" Content="日本語" Margin="5" Padding="20,3" Click="btJP_Click" />
				<Button Name="btEng" Content="English" Margin="5" Padding="20,3" Click="btEng_Click" />
				<Button Name="btSetting" Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Setting}" Margin="5" Padding="20,3" Click="btSetting_Click" />
				<Button Name="btOperation" Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Operation}" Margin="5" Padding="20,3" Click="btOperation_Click" />
			</StackPanel>
			<Grid>
				<ListBox Name="lbSetting" HorizontalAlignment="Stretch" MinHeight="30" MinWidth="100"
					 AllowDrop="True" PreviewDragOver="lbSetting_PreviewDragOver" Drop="lbSetting_Drop" PreviewKeyDown="lbSetting_PreviewKeyDown">
					<ListBox.ItemContainerStyle>
						<Style TargetType="ListBoxItem">
							<Style.Triggers>
								<Trigger Property="IsSelected" Value="true">
									<Setter Property="Foreground" Value="Blue"/>
								</Trigger>
							</Style.Triggers>
							<Setter Property="HorizontalAlignment" Value="Stretch"/>
							<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
							<Setter Property="ListBoxItem.HorizontalContentAlignment" Value="Stretch"/>
						</Style>
					</ListBox.ItemContainerStyle>
					<ListBox.ItemTemplate>
						<DataTemplate>
							<Border Margin="5" BorderBrush="RosyBrown" BorderThickness="1" CornerRadius="5" Background="white" HorizontalAlignment="Stretch">
								<DockPanel HorizontalAlignment="Stretch">
									<TextBlock DockPanel.Dock="Left"  Margin="5" Text="{Binding Type}" VerticalAlignment="Center" Width="70" />
									<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Stretch">
										<Button Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.AddCopy}" Margin="5" Click="AddCopy_Click"/>
										<ListBox Name="test" ItemsSource="{Binding ltCopy}" Margin="5" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" MouseDoubleClick="test_MouseDoubleClick" PreviewKeyDown="test_PreviewKeyDown">
											<ListBox.ItemTemplate>
												<DataTemplate>
													<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
														<StackPanel.Resources>
															<Style TargetType="TextBlock">
																<Setter Property="Margin" Value="5"/>
																<Setter Property="VerticalAlignment" Value="Center"/>
															</Style>
														</StackPanel.Resources>
														<TextBlock Text="{Binding PathFrom}"/>
														<TextBlock Text="→"/>
														<TextBlock Text="{Binding CopyType}"/>
														<TextBlock Text="→"/>
														<TextBlock Text="{Binding PathTo}"/>
													</StackPanel>
												</DataTemplate>
											</ListBox.ItemTemplate>
										</ListBox>
									</StackPanel>
									<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Stretch">
										<ComboBox Margin="5" Width="150" ItemsSource="{Binding Setting}" SelectedValue="{Binding SelectedSetting}"/>
										<ComboBox Margin="5" Width="70" SelectedValue="{Binding SelectedBuild}" SelectedValuePath="Content">
											<ComboBoxItem Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Build}"/>
											<ComboBoxItem Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Rebuild}"/>
										</ComboBox>
										<CheckBox Content="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Clean}" IsChecked="{Binding IsClean}" Margin="5" VerticalAlignment="Center"/>
									</StackPanel>

									<TextBlock DockPanel.Dock="Left" Text="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.BuildFile}" VerticalAlignment="Center" Margin="5"/>
									<TextBlock Text="{Binding FilePath}"  Margin="5" HorizontalAlignment="Stretch"/>
								</DockPanel>
							</Border>
						</DataTemplate>
					</ListBox.ItemTemplate>
					<ListBox.Style>
						<Style TargetType="ListBox">
							<Style.Triggers>
								<DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}" Value="0">
									<Setter Property="Template">
										<Setter.Value>
											<ControlTemplate>
												<Grid>
													<Label VerticalAlignment="Stretch" HorizontalAlignment="Stretch" 
														   VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
															   Foreground="Gray" AllowDrop="True"
														Content="[設計画面] sln ファイルか dswファイルをドラッグ＆ドロップして下さい。No items to display"
															   Style="{StaticResource nodata}">
															   <!--PreviewDragOver="lbSetting_PreviewDragOver" Drop="lbSetting_Drop">-->
														<!--<EventSetter Event="PreviewDragOver" Handler="lbSetting_PreviewDragOver" />
														<EventSetter Event="Drop" Handler="lbSetting_Drop" />-->
													</Label>
												</Grid>
											</ControlTemplate>
										</Setter.Value>
									</Setter>
								</DataTrigger>
							</Style.Triggers>
						</Style>
					</ListBox.Style>
				</ListBox>
				<ListBox Name="lbOperaiton" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Visibility="Collapsed">
					<ListBox.Resources>
						<DataTemplate DataType="{x:Type app:OpeCompile}" >
							<Border BorderBrush="Gray" BorderThickness="1" Margin="5">
								<DockPanel>
									<Border BorderBrush="Gray" BorderThickness="0,0,1,0" Margin="0" Background="Gray">
										<app:ucWorking DockPanel.Dock="Left" VerticalAlignment="Stretch" 
													   HorizontalAlignment="Center" Width="25" Status="{Binding Status7, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"/>
										<!--<Label DockPanel.Dock="Left"  Foreground="White" FontWeight="Bold" Content="-" HorizontalContentAlignment="Center"
												   VerticalAlignment="Center" HorizontalAlignment="Center" Width="25"/>-->
									</Border>
									<TextBlock DockPanel.Dock="Left"  Margin="5" Text="{Binding Type}" VerticalAlignment="Center" />
									<TextBlock DockPanel.Dock="Left" Text="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.BuildFile}" VerticalAlignment="Center" Margin="5"/>
									<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
										<TextBlock Text="{Binding Error.Count,UpdateSourceTrigger=PropertyChanged}" Margin="5" Width="55" TextAlignment="Right"/>
										<TextBlock Text="エラー"  Margin="5"/>
									</StackPanel>
									<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
										<TextBlock Text="{Binding Warning.Count,UpdateSourceTrigger=PropertyChanged}" Margin="5" Width="55" TextAlignment="Right"/>
										<TextBlock Text="警告"  Margin="5"/>
									</StackPanel>
									<TextBlock DockPanel.Dock="Right" Text="{Binding Setting}"  Margin="5" HorizontalAlignment="Stretch"/>
									<TextBlock DockPanel.Dock="Right" Text="{Binding SelectedBuild}"  Margin="5" HorizontalAlignment="Stretch"/>
									<TextBlock Text="{Binding FilePath}"  Margin="5" HorizontalAlignment="Stretch"/>
								</DockPanel>
							</Border>
						</DataTemplate>
						<DataTemplate DataType="{x:Type app:OpeClean}" >
							<Border BorderBrush="Gray"  BorderThickness="1" Margin="5">
								<DockPanel>
									<Border BorderBrush="Gray" BorderThickness="0,0,1,0" Margin="0" Background="Gray">
										<app:ucWorking DockPanel.Dock="Left" VerticalAlignment="Stretch" 
													   HorizontalAlignment="Center" Width="25" Status="{Binding Status7, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"/>
										<!--<Label DockPanel.Dock="Left"  Foreground="White" FontWeight="Bold" Content="→" HorizontalContentAlignment="Center"
												   VerticalAlignment="Center" HorizontalAlignment="Center" Width="25"/>-->
									</Border>
									<TextBlock DockPanel.Dock="Left"  Margin="5" Text="{Binding Type}" VerticalAlignment="Center" />
									<TextBlock DockPanel.Dock="Left" Text="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.BuildFile}" VerticalAlignment="Center" Margin="5"/>
									<TextBlock DockPanel.Dock="Right" Text="{Binding Source={x:Static app:ResourceService.Current}, Path=Resources.Clean}"  Margin="5" HorizontalAlignment="Stretch"/>
									<TextBlock Text="{Binding FilePath}"  Margin="5" HorizontalAlignment="Stretch"/>
								</DockPanel>
							</Border>
						</DataTemplate>
						<DataTemplate DataType="{x:Type app:CopyFile}" >
							<Border BorderBrush="Gray" BorderThickness="1" Margin="5">
								<DockPanel>
									<Border BorderBrush="Gray" BorderThickness="0,0,1,0" Margin="0" Background="Gray">
										<app:ucWorking DockPanel.Dock="Left" VerticalAlignment="Stretch" 
													   HorizontalAlignment="Center" Width="25" Status="{Binding Status7, UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"/>
										<!--<Label DockPanel.Dock="Left"  Foreground="White" FontWeight="Bold" Content="→" HorizontalContentAlignment="Center"
												   VerticalAlignment="Center" HorizontalAlignment="Center" Width="25"/>-->
									</Border>
									<TextBlock Text="{Binding PathFrom}" Margin="5"/>
									<TextBlock Text="→" Margin="5"/>
									<TextBlock Text="{Binding CopyType}" Margin="5"/>
									<TextBlock Text="→" Margin="5"/>
									<TextBlock Text="{Binding PathTo}" Margin="5"/>
								</DockPanel>
							</Border>
						</DataTemplate>
					</ListBox.Resources>
					<ListBox.Style>
						<Style TargetType="ListBox">
							<Style.Triggers>
								<DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}" Value="0">
									<Setter Property="Template">
										<Setter.Value>
											<ControlTemplate>
												<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray">[実行結果画面] No items to display</TextBlock>
											</ControlTemplate>
										</Setter.Value>
									</Setter>
								</DataTrigger>
							</Style.Triggers>
						</Style>
					</ListBox.Style>
				</ListBox>
			</Grid>
		</DockPanel>
		<GridSplitter Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Height="5"/>
		<TextBox Grid.Row="2"
				Name="textEditor"
				FontFamily="Consolas"
				FontSize="10pt" Padding="5" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
		</TextBox>


	</Grid>
</Window>
